package main

import (
	"encoding/json"
	"fmt"
	__ "gitee.com/DonHz/electronic-business-systems/helloword/proto"
	"github.com/golang/protobuf/proto"
)

type Hello struct {
	Name string `json:"name"`
	Age  int64  `json:"age"`
}

func main() {
	req := __.HelloRequest{
		Name: "Tom",
		Age:  15,
	}
	jsonStruct := Hello{"Tom", 15}
	jsonRsp, _ := json.Marshal(&jsonStruct)
	fmt.Println(len(jsonRsp))
	resp, _ := proto.Marshal(&req)

	newReq := __.HelloRequest{}
	_ = proto.Unmarshal(resp, &newReq)
	fmt.Println(len(resp))
	fmt.Println(newReq.Name, newReq.Age)
}
